package com.SouthernWall_404.AgeSuitcase.Common.event;

import com.SouthernWall_404.AgeSuitcase.Client.Gui.Screens.LoginScreen;
import com.SouthernWall_404.AgeSuitcase.Common.API.GuiSoundHelper;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraftforge.client.event.ScreenEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

public class GuiEvent {
    @SubscribeEvent
    public static void onScreenRender(ScreenEvent.Opening event) {
        GuiSoundHelper.playLoadingFinish();
        if (event.getScreen() instanceof TitleScreen) {

            event.setNewScreen(new LoginScreen());
//            ResourceLocation START_SCREEN=new ResourceLocation(AgeSuitcase.MODID,"textures/gui/screen/start.png");
//
//            GuiGraphics guiGraphics = event.getGuiGraphics();
//            PoseStack poseStack = guiGraphics.pose();
//            int width = event.getScreen().width;
//            int height = event.getScreen().height;
//
//            guiGraphics.blit(START_SCREEN,0,0,width,height,0f,0f,1280,2457,1280,2457);
//
//            // 绘制自定义背景
//            guiGraphics.fillGradient(0, 0, width, height, 0xFF000033, 0xFF330000);
//
//            // 绘制自定义标题
//            Font font = Minecraft.getInstance().font;
//            poseStack.pushPose();
//            poseStack.translate(width / 2f, height / 4f, 0);
//            poseStack.scale(3.0f, 3.0f, 1.0f);
//            guiGraphics.drawString(
//                    font,
//                    Component.literal("我的自定义服务器").withStyle(ChatFormatting.GOLD),
//                    -font.width("我的自定义服务器") / 2,
//                    0,
//                    0xFFFFFF,
//                    true
//            );
//            poseStack.popPose();
        }
    }
}
